
public class For {
    public static void main(String[] args) {
        int sum =0;
        for (int i=1;i<=100;i++){
            sum = sum+i;
        }
        System.out.println(sum);

        int[] ns = { 1, 4, 9, 16, 25 };
        int sum2 = 0;
        for (int i=0; i<ns.length; i++) {
            System.out.println("i = " + i + ", ns[i] = " + ns[i]);
            sum2 = sum2 + ns[i];
        }
        System.out.println("sum = " + sum2);

        int[] ns1 = { 1, 4, 9, 16, 25 };
        for (int n : ns1) {
            System.out.println(n);
        }

        double pi = 0;
        double n = 0;
        for (double i=1;i<9999;i++) {
            n = 1/(2*i-1);
            pi = pi+Math.pow(-1,i+1)*n;


        }
        System.out.println(pi*4);
    }
}
